Add support for -t/--tuples-only option to print rows without extra output#1545
Add support for -t/--tuples-only option to print rows without extra output#1545DiegoDAF wants to merge 3 commits into
Conversation
|
Thank you for the PR! I have some problems with it, for two reasons:
This does not solve your header / status suppression requirement, but I think that should be a separate change. Perhaps pgcli should be aware of |
|
Thanks for the feedback, makes total sense! I'll rework this PR so that The |
5ca0788 to
3d86709
Compare
Made with ❤️ and 🤖 Claude
|
This has conflicts. |
3d86709 to
e1cf78c
Compare
…ression Simplified per reviewer feedback (j-bennet): - `-t` is now a pure boolean flag (no format argument) - Sets table_format to csv-noheader at startup (like `\T csv-noheader`) - Does NOT suppress timing or status messages - Removed tuples_only from OutputSettings namedtuple - For custom formats, use `\T FORMAT` interactively Made with ❤️ and 🤖 Claude
e1cf78c to
8756bfe
Compare
Spurious reformat introduced during rebase; ruff 0.15.11 with preview=true keeps the original split form. Restores upstream layout.
# Conflicts: # changelog.rst
|
Reworked per your feedback: |
|
Hey @j-bennet! 🎉 Congrats on shipping 4.5.0, and thank you so much for merging #1559, really made my week! While you are in release mode, would you have a moment to peek at this one too? It is rebased and green now that the CI env vars are back. Totally understand if you are swamped, no pressure at all. Thanks again for everything you do for pgcli! 🙏 |
Summary
This PR implements the
-t/--tuples-onlyoption, similar to psql's-tflag, which prints query results without status messages or timing information. This is useful for scripting and piping output to other commands.Features
pgcli -toutputs rows in CSV format without headerspgcli -t minimalallows specifying any table formatUse Cases
Implementation Details
tuples_onlyfield toOutputSettingsnamedtupletuples_onlyparameter toPGCli.__init__()format_output()to skip status whentuples_only=Truetuples_onlyflagis_flag=Falsewithflag_value="csv-noheader"-talone defaults to csv-noheader-t <format>allows custom formatsCompatibility
Made with ❤️ and 🤖 Claude Code